#/bin/bash

if (($# < 1)); then
    exit 1
fi

now=`date +'%Y-%m-%d %H:00:00'`
sql="SELECT $1 FROM server WHERE (merged=0 OR merged=id) AND time < '$now'";
if [ "" != "$2" ]; then
    sql+=" AND $2"
fi

./mysql/query.sh "login" "$sql"
